﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/*
namespace Xww.LCV.Model {
    ///<summary>表示一组(蛋白质)序列的有向图
    ///实际以字典存储：key为字符(氨基酸)，value为若干个字符串链表节点(用于反向检索)
    ///应使用静态函数创建此对象的实例
    ///</summary>
    public abstract class VetexDict : Dictionary<string, List<LinkedListNode<string>>> {


        ///<summary>添加一个顶点及其对应的双向链表结点集合（如已有记录则附加至原有列表）</summary>
        public void AddVetex(string key, params LinkedListNode<string>[] nodes) {
            if (!this.ContainsKey(key)) {
                this.Add(key, new List<LinkedListNode<string>>());
            }
            this[key].AddRange(nodes);
        }

        public override string ToString() {
            StringBuilder rst = new StringBuilder();
            foreach (var item in this) {
                rst.AppendFormat("{0} : {1} nodes", item.Key, item.Value.Count);
                rst.AppendLine();
            }
            return rst.ToString();
        }


        #region Extract motifs using threshold

        public abstract IList<LCS> ExtractMotifs(IEnumerable<SequencePath> listPaths);


        #endregion

        #region static


        public static VetexDict CreateFromSequencePath(IEnumerable<SequencePath> paths, MiningParam param) {
            if (param.MiningType != MiningType.RelativePositionProbability && param.MiningType != MiningType.RelativePositionThreshold) {
                throw new ArgumentException("The param used in Relative Generator should be type of MiningType.RelativePosition", "param");
            }
            //todo 此处需更改为相对位置模式选择，既可以为阈值也可为概率衰减。
            VetexDict rst = null;
            if (param.MiningType == MiningType.RelativePositionProbability) {
                rst = new ProbabilityVetexDict(param.ProbabilityDrop, param.Alpha, param.MinInterval, param.MaxInterval, param.IsDiscrete);
            }
            if (param.MiningType == MiningType.RelativePositionThreshold) {
                rst = new ThresholdVetexDict(param.Threshold, param.MinInterval, param.MaxInterval);
            }
            foreach (SequencePath path in paths) {
                var node = path.First;
                while (node != null) {
                    rst.AddVetex(node.Value, node);
                    node = node.Next;
                }
            }
            return rst;
        }

        #endregion
    }
}

*/